<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/',function(){
    return redirect()->route('financeIndex');
});
//后台登录页面
Route::group(['namespace'=>'Admin','prefix'=>'admin'],function (){
    Route::group(['prefix'=>'login'],function (){
        //登录页面
        Route::get('index','LoginController@index')->middleware('admin.login');
        //处理登录操作
        Route::post('tologin','LoginController@tologin');
        //退出
        Route::get('logout','LoginController@logout');
    });
});
// Admin 模块
Route::group(['namespace'=>'Admin','prefix'=>'admin','middleware'=>'admin.auth'],function (){
    Route::group(['prefix'=>'index'],function (){
        //首页页面
        Route::get('index','IndexController@index');
    });

    #用户管理
    Route::group(['prefix'=>'user'],function (){
        Route::get('index','UserController@index');#用户列表
        Route::get('destroy/{id}','UserController@destroy');#用户删除
        Route::get('disabled/{id}','UserController@disabled');#用户禁用
        Route::get('rebateBenefit/{id}','UserController@rebateBenefit');#用户收益
        Route::get('rebateDevote/{id}','UserController@rebateDevote');#用户贡献

    });

    #分佣管理
    Route::group(['prefix'=>'rebate'],function (){
        Route::get('index','RebateController@index');#分佣比例列表
        Route::get('edit/{key}/{rate}','RebateController@edit');#分佣比例修改
    });

    #代充值管理
    Route::group(['prefix'=>'RechargeCommission'],function (){
        Route::get('index','RechargeCommissionController@index');#代充值列表
        Route::get('edit/{rate}','RechargeCommissionController@edit');#代充值比例修改
    });

    #红包管理
    Route::group(['prefix'=>'RedBag'],function (){
        Route::get('index','RedBagController@index');#红包列表
        Route::get('edit/{amount}','RedBagController@edit');#红包分发金额修改
    });

    #会员卡管理
    Route::group(['prefix'=>'vip'],function (){
        Route::get('index','VipController@index');#会员卡列表
        Route::get('modifyVipLimit/{amount}','VipController@modifyVipLimit');#会员卡临界值修改
        Route::get('disabled/{id}/{vip_card_status}','VipController@disabled');#会员卡状态修改
        Route::match(['get','post'],'add','VipController@add');#会员卡新增
        Route::match(['get','post'],'edit/{id}','VipController@edit');#会员卡修改
        Route::match(['get','post'],'unBind/{id}','VipController@unBind');#会员卡解绑
    });

    #意见反馈
    Route::group(['prefix'=>'FeedBack'],function (){
        Route::get('index','FeedBackController@index');#反馈列表

    });


    //首页==>banner模块
    Route::group(['prefix'=>'banner'],function (){
        Route::get('index','BannerController@index');
        Route::get('destroy/{id}','BannerController@destroy')->where('id','[0-9]+');
        Route::get('create','BannerController@create');
        Route::post('store','BannerController@store');
        Route::get('edit/{id}','BannerController@edit');
        Route::post('update/{id}','BannerController@update');
    });
    //首页==>系统管理模块
    Route::group(['prefix'=>'system'],function (){
        Route::get('aboutus','SystemController@aboutus');//关于我们
        Route::get('aboutus_edit/{id}','SystemController@aboutus_edit');
        Route::post('aboutus_update/{id}','SystemController@aboutus_update');
        Route::get('loginlogs','SystemController@loginlogs');
        Route::get('actionlog','SystemController@actionlog');
    });

    //商品==>分类管理模块
    Route::group(['prefix'=>'goods'],function (){
        Route::get('category','GoodsController@category');
        Route::get('create','GoodsController@create');
        Route::post('cate_store','GoodsController@cate_store');
        Route::get('cate_destory/{id}','GoodsController@cate_destory');
        Route::get('cate_edit/{id}','GoodsController@cate_edit');
        Route::post('cate_update/{id}','GoodsController@cate_update');
    });

    //商品==>商品管理模块
    Route::group(['prefix'=>'spu'],function (){
        Route::get('template_spu_list','SpuController@ajax_spu_list_of_templateController');
        //商品列表接口
        Route::get('ajax_spu_list','SpuController@ajax_spu_list');
        //商品列表首页
        Route::get('index','SpuController@index');
        //商品的上下架
        Route::get('market/{spu_id}/{marketable}','SpuController@market');
        //商品创建页面
        Route::get('create','SpuController@create_form');
        //商品编辑页面
        Route::get('edit/{spu_id}','SpuController@edit_form');
        //商品创建
        Route::post('docreate','SpuController@docreate');
        //商品编辑
        Route::post('doedit','SpuController@doedit');
        //商品的删除
        Route::get('del/{spu_id?}','SpuController@del');
        //商品图片上传
        Route::post('uploadImg','SpuController@uploadImg');
        //商品的删除图片功能
        Route::post('delImg','SpuController@deleteImg');
        //商品的bootstrapfileinput初始化图片列表的配置获取
        Route::get('bsconfig/{spu_id?}','SpuController@bsImgConfig');
    });

    //规格管理
    Route::group(['prefix'=>'property'],function (){
        //商品规格首页
        Route::get('index','PropertyController@index');
        //规格创建页面
        Route::get('create','PropertyController@create_form');
        //规格编辑页面
        Route::get('update/{props_id}','PropertyController@update_form');
        //规格创建方法
        Route::post('docreate','PropertyController@create');
        //规格编辑方法
        Route::post('doupdate','PropertyController@update');
        //规格编辑方法
        Route::get('delete/{props_id}','PropertyController@delete');
    });

    //商品==>分类管理模块
    Route::group(['prefix'=>'comment'],function (){
        Route::get('index','CommentController@index');
        Route::get('destory/{id}','CommentController@destory');
    });

    //订单管理模块
    Route::group(['prefix'=>'order'],function (){
        Route::get('index','OrderController@index');
//        Route::get('detail/{id}','OrderController@detail');
        Route::get('ajax_list','OrderController@ajax_list');
        Route::get('getExpress','OrderController@getExpress');
        Route::get('send','OrderController@send');
        Route::get('complete','OrderController@complete');
        Route::get('detail','OrderController@detail');
    });

    //优惠券管理模块
    Route::group(['prefix'=>'coupon'],function (){
        //优惠券规则模块
        Route::get('rule','CouponController@rule');
        //优惠券规则创建页面
        Route::get('create_rule_form','CouponController@create_rule_form');
        //优惠券规则编辑页面
        Route::get('edit_rule_form/{rule_id?}','CouponController@edit_rule_form');
        //优惠券规则创建
        Route::post('createrule','CouponController@createrule');
        //优惠券规则编辑
        Route::post('editrule','CouponController@editrule');
        //优惠券规则删除
        Route::get('delterule/{rule_id?}','CouponController@delterule');

        //优惠券列表
        Route::get('coupon_list','CouponController@coupon_list');
        //优惠券创建页面
        Route::get('create_coupon_form','CouponController@create_coupon_form');
        //优惠券编辑页面
        Route::get('edit_coupon_form/{coupon_id?}','CouponController@edit_coupon_form');
        //优惠券创建
        Route::post('create_coupon','CouponController@create_coupon');
        //优惠券编辑
        Route::post('edit_coupon','CouponController@edit_coupon');
        //优惠券删除
        Route::get('delete_coupon/{coupon_id?}','CouponController@delete_coupon');
    });

    //充值优惠管理模块
    Route::group(['prefix'=>'recharge'],function (){
        //充值优惠配置页面
        Route::get('index','RechargeController@index');
        //充值优惠配置保存
        Route::post('save','RechargeController@save');
    });

    //提现管理
    Route::group(['prefix'=>'cash'],function (){
        //提现列表页
        Route::get('index','CashController@index');
        //提现配置页面
        Route::get('set_index','CashController@set_index');
        //提现
        Route::get('docash/{cash_id}','CashController@docash');
        //提现配置保存
        Route::post('save_set','CashController@save_set');
    });

    //合伙人管理页面
    Route::group(['prefix'=>'copartner'],function (){
        //合伙人申请列表页
        Route::get('apply','CopartnerController@apply');
        //同意或者拒绝申请
        Route::get('doapply/{id}/{status}','CopartnerController@doapply');
    });

    //财务管理
    Route::group(['prefix'=>'finance'],function (){
        //财务管理列表页
        Route::get('index','FinanceController@index')->name('financeIndex');
        //用户订单接口返回
        Route::get('user_order','FinanceController@user_order_list');
        //用户收货地址接口返回
        Route::get('addresslist','FinanceController@user_address_list');
        //用户分页数据
        Route::get('UserListWithPage','FinanceController@UserListWithPage');
        Route::get('getLowerBNF','FinanceController@getLowerBNF');
    });

    Route::group(['prefix'=>'hotel'],function (){
        Route::get('index','HotelController@index');#列表
        Route::get('edit_view/{hotel_id}','HotelController@edit_view');#编辑页面
        Route::get('create_view','HotelController@create_view');#新增页面
        Route::post('save','HotelController@save');#e新增或修改
        Route::get('apply_template/{hotel_id}','HotelController@apply_template');#酒店批量应用模板
        Route::get('hotel_goods_view/{hotel_id?}','HotelController@hotel_goods_view');#酒店商品列表
        Route::get('delete_hotel/{hotel_id?}','HotelController@delete_hotel');#删除酒店

    });

    Route::group(['prefix'=>'machine'],function (){
        Route::get('index/{hotel_id?}','MachineController@index');#设备列表
        Route::any('getHotelList','MachineController@getHotelList');#获取设备列表数据
    });

    Route::group(['prefix'=>'template'],function (){
        Route::get('index','TemplateController@index');#模板管理列表
        Route::post('save','TemplateController@save');#模板管理列表
    });

    Route::group(['prefix'=>'hotelowner'],function (){
        Route::get('apply_list','HotelOwnerController@apply_list');#商家入驻申请列表
        Route::get('update_status','HotelOwnerController@update_status');#商家入驻更新接口
    });



});